import { ref } from "vue";
import IPC from "../background/ipc";

export default function useTableRepositories(like) {
  const tebleList = ref([]);

  const getTableList = async (linkId) => {
    let result = await IPC.invoke("mysql.tables", {
      linkId: linkId,
      like: like.value,
    });
    if (result.code < 0) {
      alert(result.msg);
      tebleList.value = [];
      return;
    }
    tebleList.value = result.data;
  };

  return {
    tebleList,
    getTableList,
  };
}
